// For `cargo help foo`, print out the usage message for the specified
// subcommand by executing the command with the `-h` flag.
- "help" => {
- vec!["cargo".to_string(), flags.arg_args[0].clone(),
- "-h".to_string()]
- }
+ "help" => vec!["cargo".to_string(), flags.arg_args[0].clone(),
+ "-h".to_string()],
// For all other invocations, we're of the form `cargo foo args...`. We
// use the exact environment arguments to preserve tokens like `--` for
.filter(|&(d, _)| d < 4)
.collect::<Vec<_>>();
filtered.sort_by(|a, b| a.0.cmp(&b.0));
- filtered.get(0).map(|slot| slot.1.to_string())
+ filtered.get(0).map(|slot| slot.1.clone())
}
fn execute_subcommand(config: &Config,
if let Some(val) = env::var_os("PATH") {
dirs.extend(env::split_paths(&val));
}
- return dirs
+ dirs
}
fn init_git_transports(config: &Config) {
let root = try!(find_root_manifest_for_wd(options.flag_manifest_path, config.cwd()));
- let mut doc_opts = ops::DocOptions {
+ let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
config: config,
},
};
- try!(ops::doc(&root, &mut doc_opts).map_err(|err| {
+ try!(ops::doc(&root, &doc_opts).map_err(|err| {
CliError::from_boxed(err, 101)
}));
Ok(None)
}
-
})
.map_err(|e| CliError::from_boxed(e, 1)));
- let reference = GitReference::Branch(reference.to_string());
+ let reference = GitReference::Branch(reference.clone());
let source_id = SourceId::for_git(&url, reference);
let mut source = GitSource::new(&source_id, config);
try!(source.update().map_err(|err| CliError::new(err.description(), 1)));
source.root_package()
- .map(|pkg| Some(pkg))
+ .map(Some)
.map_err(|err| CliError::from_boxed(err, 1))
}
let root = try!(find_root_manifest_for_wd(options.flag_manifest_path,
config.cwd()));
- let mut doc_opts = ops::DocOptions {
+ let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
config: config,
},
};
- try!(ops::doc(&root, &mut doc_opts));
+ try!(ops::doc(&root, &doc_opts));
Ok(None)
}
-
use std::env;
use std::fs;
-use std::io::prelude::*;
use std::io::{self, ErrorKind};
use std::path::{Path, PathBuf};
use std::sync::{Once, ONCE_INIT};